<?php
use OSS\Core\OssException;
use OSS\OssClient;
function getFileObject($bucket)
{
    $ossClient = new OssClient(ossAccessKeyId, ossAccessKeySecret, ossEndpoint);
    $nextMarker = '';
    $lists = [];
    while (true) {
        try {
            $options = array(
                'delimiter' => '',
                'marker' => $nextMarker,
            );
            $listObjectInfo = $ossClient->listObjects($bucket, $options);
        } catch (OssException $e) {
            printf(__FUNCTION__ . ": FAILED\n");
            printf($e->getMessage() . "\n");
            return;
        }

        $nextMarker = $listObjectInfo->getNextMarker();
        $listObject = $listObjectInfo->getObjectList();
        $listPrefix = $listObjectInfo->getPrefixList();

        if (!empty($listObject)) {
            foreach ($listObject as $objectInfo) {
                $lists[] = $objectInfo->getKey();
            }
        }
        if (!empty($listPrefix)) {
            foreach ($listPrefix as $prefixInfo) {
                $lists[] = $objectInfo->getPrefix();
            }
        }
        if ($listObjectInfo->getIsTruncated() !== "true") {
            break;
        }
    }
    return $lists;
}
